// $ANTLR : "Anasint.g" -> "Anasint.java"$

	package practpl.tres;
	

import antlr.TokenBuffer;
import antlr.TokenStreamException;
import antlr.TokenStreamIOException;
import antlr.ANTLRException;
import antlr.LLkParser;
import antlr.Token;
import antlr.TokenStream;
import antlr.RecognitionException;
import antlr.NoViableAltException;
import antlr.MismatchedTokenException;
import antlr.SemanticException;
import antlr.ParserSharedInputState;
import antlr.collections.impl.BitSet;

public class Anasint extends antlr.LLkParser       implements AnasintTokenTypes
 {

		private boolean fallo = false;
		public boolean Detectafallo(){return fallo;}
	
protected Anasint(TokenBuffer tokenBuf, int k) {
  super(tokenBuf,k);
  tokenNames = _tokenNames;
}

public Anasint(TokenBuffer tokenBuf) {
  this(tokenBuf,1);
}

protected Anasint(TokenStream lexer, int k) {
  super(lexer,k);
  tokenNames = _tokenNames;
}

public Anasint(TokenStream lexer) {
  this(lexer,1);
}

public Anasint(ParserSharedInputState state) {
  super(state,1);
  tokenNames = _tokenNames;
}

	public final void entrada() throws RecognitionException, TokenStreamException {
		
		
		try {      // for error handling
			{
			_loop3:
			do {
				switch ( LA(1)) {
				case WHILE:
				case IDENT:
				case FOR:
				{
					asignacion();
					break;
				}
				case SET:
				{
					asignacion2();
					break;
				}
				default:
				{
					break _loop3;
				}
				}
			} while (true);
			}
			match(Token.EOF_TYPE);
			fallo = true;
		}
		catch (RecognitionException ex) {
			reportError(ex);
			recover(ex,_tokenSet_0);
		}
	}
	
	public final void asignacion() throws RecognitionException, TokenStreamException {
		
		
		try {      // for error handling
			switch ( LA(1)) {
			case IDENT:
			{
				{
				match(IDENT);
				match(OPERADOR);
				auxiliar();
				match(SEPARADOR);
				}
				break;
			}
			case WHILE:
			case FOR:
			{
				bucle();
				break;
			}
			default:
			{
				throw new NoViableAltException(LT(1), getFilename());
			}
			}
		}
		catch (RecognitionException ex) {
			reportError(ex);
			recover(ex,_tokenSet_1);
		}
	}
	
	public final void asignacion2() throws RecognitionException, TokenStreamException {
		
		
		try {      // for error handling
			match(SET);
			match(DOLAR);
			match(IDENT);
			match(OPERADOR);
			auxiliar();
			match(SEPARADOR);
			{
			switch ( LA(1)) {
			case IF:
			{
				match(IF);
				match(PARENTA);
				match(DOLAR);
				match(IDENT);
				match(PARENTC);
				match(LLAVEA);
				match(IDENT);
				match(OPERADOR);
				auxiliar();
				match(SEPARADOR);
				match(LLAVEC);
				break;
			}
			case EOF:
			case SET:
			case WHILE:
			case IDENT:
			case FOR:
			{
				break;
			}
			default:
			{
				throw new NoViableAltException(LT(1), getFilename());
			}
			}
			}
		}
		catch (RecognitionException ex) {
			reportError(ex);
			recover(ex,_tokenSet_1);
		}
	}
	
	public final void auxiliar() throws RecognitionException, TokenStreamException {
		
		
		try {      // for error handling
			{
			switch ( LA(1)) {
			case NUMERO:
			{
				match(NUMERO);
				break;
			}
			case BOOLEANO:
			{
				match(BOOLEANO);
				break;
			}
			case RUTA:
			{
				match(RUTA);
				break;
			}
			case TEXTO:
			{
				match(TEXTO);
				break;
			}
			default:
			{
				throw new NoViableAltException(LT(1), getFilename());
			}
			}
			}
		}
		catch (RecognitionException ex) {
			reportError(ex);
			recover(ex,_tokenSet_2);
		}
	}
	
	public final void bucle() throws RecognitionException, TokenStreamException {
		
		
		try {      // for error handling
			{
			switch ( LA(1)) {
			case FOR:
			{
				match(FOR);
				break;
			}
			case WHILE:
			{
				match(WHILE);
				break;
			}
			default:
			{
				throw new NoViableAltException(LT(1), getFilename());
			}
			}
			}
			{
			match(PARENTA);
			match(DOLAR);
			match(IDENT);
			match(PARENTC);
			}
			{
			match(LLAVEA);
			match(IDENT);
			match(OPERADOR);
			auxiliar();
			match(SEPARADOR);
			match(LLAVEC);
			}
		}
		catch (RecognitionException ex) {
			reportError(ex);
			recover(ex,_tokenSet_1);
		}
	}
	
	public final void entrada2() throws RecognitionException, TokenStreamException {
		
		
		try {      // for error handling
			{
			_loop16:
			do {
				switch ( LA(1)) {
				case WHILE:
				case IDENT:
				case FOR:
				{
					asig();
					break;
				}
				case SET:
				{
					asig2();
					break;
				}
				default:
				{
					break _loop16;
				}
				}
			} while (true);
			}
			match(Token.EOF_TYPE);
		}
		catch (RecognitionException ex) {
			reportError(ex);
			recover(ex,_tokenSet_0);
		}
	}
	
	public final void asig() throws RecognitionException, TokenStreamException {
		
		
		try {      // for error handling
			switch ( LA(1)) {
			case IDENT:
			{
				{
				match(IDENT);
				match(OPERADOR);
				auxiliar();
				}
				break;
			}
			case WHILE:
			case FOR:
			{
				bucle2();
				break;
			}
			default:
			{
				throw new NoViableAltException(LT(1), getFilename());
			}
			}
		}
		catch (RecognitionException ex) {
			reportError(ex);
			recover(ex,_tokenSet_1);
		}
	}
	
	public final void asig2() throws RecognitionException, TokenStreamException {
		
		
		try {      // for error handling
			match(SET);
			match(DOLAR);
			match(IDENT);
			match(OPERADOR);
			auxiliar();
			{
			switch ( LA(1)) {
			case IF:
			{
				match(IF);
				match(PARENTA);
				match(DOLAR);
				match(IDENT);
				match(PARENTC);
				match(LLAVEA);
				match(IDENT);
				match(OPERADOR);
				auxiliar();
				match(LLAVEC);
				break;
			}
			case EOF:
			case SET:
			case WHILE:
			case IDENT:
			case FOR:
			{
				break;
			}
			default:
			{
				throw new NoViableAltException(LT(1), getFilename());
			}
			}
			}
		}
		catch (RecognitionException ex) {
			reportError(ex);
			recover(ex,_tokenSet_1);
		}
	}
	
	public final void bucle2() throws RecognitionException, TokenStreamException {
		
		
		try {      // for error handling
			{
			switch ( LA(1)) {
			case FOR:
			{
				match(FOR);
				break;
			}
			case WHILE:
			{
				match(WHILE);
				break;
			}
			default:
			{
				throw new NoViableAltException(LT(1), getFilename());
			}
			}
			}
			match(PARENTA);
			match(DOLAR);
			match(IDENT);
			match(PARENTC);
			match(LLAVEA);
			match(IDENT);
			match(OPERADOR);
			auxiliar();
			match(LLAVEC);
		}
		catch (RecognitionException ex) {
			reportError(ex);
			recover(ex,_tokenSet_1);
		}
	}
	
	
	public static final String[] _tokenNames = {
		"<0>",
		"EOF",
		"<2>",
		"NULL_TREE_LOOKAHEAD",
		"\"SET\"",
		"\"IF\"",
		"\"WHILE\"",
		"BLANCO",
		"LETRA",
		"DIGITO",
		"TEXTO",
		"RUTA",
		"BOOLEANO",
		"NUMERO",
		"IDENT",
		"SEPARADOR",
		"OPERADOR",
		"DOLAR",
		"PARENTA",
		"PARENTC",
		"LLAVEA",
		"LLAVEC",
		"FOR"
	};
	
	private static final long[] mk_tokenSet_0() {
		long[] data = { 2L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
	private static final long[] mk_tokenSet_1() {
		long[] data = { 4210770L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
	private static final long[] mk_tokenSet_2() {
		long[] data = { 6340722L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
	
	}
